<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery对象和js对象之间的互相转换</title>
    <script src="../../js/jquery-1.4.2.js"></script>
</head>
<body>
    <input type="text"name="username"id="username"placeholder="请输入文本">
    <button onclick="getUsername()">点击</button>
</body>
<script>
    function getUsername(){
        var $oIn = $('#username')
        // alert($oIn.val())
        //jQuery对象转换为js对象
        alert($oIn[0].value)
        alert($oIn.get(0).value)
    }
    function getUsername1(){
        var oInput = document.getElementById('username')
        //alert(oInput.value)
        //js对象转换为jQuery对象
        alert($(oInput).val())
    }
</script>
</html>